
$(function () {
    //初始化fullpage插件
    $('.container').fullpage({
        //配置参数
        // 设置滚动速度
        // scrollingSpeed: 1000,
        // 设置各屏颜色
        sectionsColor: ["#fadd67", "#84a2d4", "#ef674d", "#ffeedd", "#d04759", "#84d9ed", "#8ac060"],
        // 设置导航
        navigation: true,

        afterLoad:function (link,index) {
            $('.section').eq(index-1).addClass('now')
        },
        onLeave:function (index,nextIndex,direction) {
            if (index==2 && nextIndex==3){
                $('.section').eq(index-1).addClass('leaved')
            }
            else if(index==3 && nextIndex==4){
                $('.section').eq(index-1).addClass('leaved')
            }
            else if(index==5 && nextIndex==6){
                $('.section').eq(index-1).addClass('leaved')
            }
            else if(index==6 && nextIndex==7){

                $('.screen07 .star img').each(function (i,item) {
                    $(this).delay(i*0.5*1000).fadeIn();
                });
                $('.screen07 .text').addClass('show')
            }
        },
        afterRender:function () {
            $('#more').on('click',function () {
                $.fn.fullpage.moveSectionDown()
            })
            $('.screen04 .cart').on('transitionend',function () {
                $('.screen04').addClass('show')
            });
            
            $('.screen08').find('.btn2').on('click',function () {
                $('.now').removeClass('now');
                $('.leaved').removeClass('leaved');
                $('.show').removeClass('show');
                $('.active').removeClass('active');
                $('.content [style]').removeAttr('style')
                $.fn.fullpage.moveTo(1);
            })

        }


    })
});